package com.vi.hcnetsdk.simpleapp;

/**
 * Created by xulin9 on 2017/9/27.
 */

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AlarmContent {
    public static final List<AlarmItem> mItems = new ArrayList<AlarmItem>();
    public static final Map<String, AlarmItem> mItemMap = new HashMap<String, AlarmItem>();
    private static int mCount = 0;

    public static void addItem(AlarmItem item) {
        synchronized (AlarmContent.class) {
            mItems.add(item);
            mItemMap.put(item.id, item);
            mCount = mItems.size();
        }
    }


    public static void clearData() {
        synchronized (AlarmContent.class) {
            mItems.clear();
            mItemMap.clear();
            mCount = 0;
        }
    }

    public static int getItemCount() {
        return mCount;
    }

    /**
     * A alarm item representing a piece of content.
     */
    public static class AlarmItem {
        public final String id;
        public final String content;
        public final String details;
        //public int index;

        public AlarmItem(String id, String content, String details) {
            this.id = id;
            this.content = content;
            this.details = details;
        }
//        public void setIndex(int index){this.index = index;}
//        public int getIndex(){return index;}
        @Override
        public String toString() {
            return content;
        }
    }
}
